<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>18 继承-原型继承</title>
</head>

<body>
  <script>
    class Parent {
      // es7语法，无传参时，私有属性可以不写到constructor中
      x = 100;
      getX() {
        return this.x;
      }
    }
    class Child extends Parent {
      y = 100;
      getY() {
        return this.y;
      }
    }

    let c1 = new Child();

    console.log(c1) //=> 去控制查看原型链上的
    console.log(c1.x) //=> 100
    console.log(c1.getX()) // 100
  </script>
</body>

</html>